package com.aWei.springbootinit.dataSource;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.aWei.springbootinit.model.dto.user.UserQueryRequest;
import com.aWei.springbootinit.model.vo.UserVO;
import com.aWei.springbootinit.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 用户服务实现
 *
 阿维
 */
@Service
@Slf4j
public class UserDataSource implements DataSource<UserVO> {

        @Resource
        private  UserService userService;

        @Override
        public Page<UserVO> doSearch(String searchText, long pageNum, long pageSize) {
                UserQueryRequest userQueryRequest=new UserQueryRequest();
                userQueryRequest.setUserName(searchText);
                userQueryRequest.setPageSize(pageSize);
                userQueryRequest.setCurrent(pageNum);
                return userService.listUserVOByPage(userQueryRequest);
        }
}
